<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
	<title>速维人事管理系统</title>
	<script type="text/javascript" src="../js/boot.js"></script>
	<script src="../js/dashboard.js" type="text/javascript"></script>
	<link rel="stylesheet" href="../css/frame/frame-left.css">
</head>

<body>
	<div class="frame">
		<!-- 顶部 -->
		<div class="frame-top">
			<!-- 顶部左边部分 -->
			<div class="frame-top-left">
				<!-- LOGO -->
				<div class="frame-top-logo">
					<!-- <img src="../img/frame/frame-top/logo.png" /> -->
				</div>
			</div>
			<!-- 顶部右边部分 -->
			<div class="frame-top-right">
				<!-- 当前时间 -->
				<div class="frame-top-time">
					<img src="../img/frame/frame-left/time.png" />
					<span>当前时间：</span><span id="datetime_"></span>
				</div>
				<!-- 当前用户 -->
				<div class="frame-top-userinfo">
					<img id="username" onclick="changePassword()" src="../img/frame/frame-left/user.png" />
				</div>
				<!-- 全屏按钮 -->
				<div class="frame-top-fullscreen">
					<img id="fullScreen_open" onclick="FullScreen.open()" src="../img/frame/frame-left/fullscreen_open.png" title="全屏" />
					<img id="fullScreen_closed" style="display: none;" onclick="FullScreen.closed()" src="../img/frame/frame-left/fullscreen_closed.png"
						title="关闭全屏" />
				</div>
				<!-- 退出登录 -->
				<div class="frame-top-loginout">
					<img onclick="logout()" src="../img/frame/frame-left/loginOut.png" title="退出登录" />
				</div>
			</div>
		</div>
		<!-- 左侧菜单 -->
		<div class="frame-left">
			<div class="frame-left-guide">
				<b>菜单导航</b>
				<img onClick="FrameMenu.hideMenu()" src="../img/frame/frame-left/guide.png" title="菜单导航" />
			</div>
			<!-- 自定义菜单 -->
			<ul id="menu" class="frame-menu"></ul>
		</div>
		<!-- 中间主区域 -->
		<div class="frame-center">
			<!-- tab页签 -->
			<div id="main-tab" class="mini-tabs" contextMenu="#tabsMenu" activeIndex="0" style="width: 100%; height: 100%;" arrowPosition="side"
				showCloseButton="true" showNavMenu="true">
			</div>
			<!-- 页签上的右键菜单 -->
			<ul id="tabsMenu" class="mini-contextmenu" onbeforeopen="FrameTab.onBeforeOpen">
				<li onclick="FrameTab.closeTab">关闭当前标签页</li>
				<li onclick="FrameTab.closeAllBut">关闭其他标签页</li>
				<li onclick="FrameTab.closeAll">关闭所有标签页</li>
			</ul>
		</div>
		<!--底部-->
		<div class="frame-bottom">
			&copy;版权所有：
			南通速维工程设备有限公司
		</div>

		<div id="detailWin" class="mini-window" title="" style="width:300px;height:200px;" showMaxButton="true" showCollapseButton="true" showShadow="true"
			showToolbar="true" showFooter="true" showModal="true" allowResize="true" allowDrag="true">
			<div id="detailForm" style="padding:10px;">
				<table align="center">
					<tr>
						<td align="right">原密码：</td>
						<td align="left"><input name="oldPassword" class="mini-password" required="true"></td>
					</tr>
					<tr>
						<td align="right">新密码：</td>
						<td align="left"><input name="loginPassword" class="mini-password" required="true"></td>
					</tr>
					<tr>
						<td align="right">确认新密码：</td>
						<td align="left"><input name="loginPassword2" class="mini-password" required="true" /></td>
					</tr>
				</table>
			</div>
			<div property="footer" style="text-align:center;padding:5px;padding-right:15px;">
				<a class="mini-button" iconCls="icon-save" onClick="save()">保存</a>
				<a class="mini-button" iconCls="icon-cancel" onClick="cancel()">取消</a>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		mini.parse();
		// 从localStorage中获取token数据和用户信息
		var obj = localStorage.getItem('user');
		var userID = null;
		if (obj) {
			var user = mini.decode(obj);
			//$(selector).html(content)
			$("#username").after(user.userName);
			userID = user.userID;
		}

		http.post("/admin/menu/biz/getMenu.do", {}, function (data) {
			var menu = data.data;
			// debugger
			//生成菜单(传参：菜单控件ID；IP；菜单图标的路径，以“/”结尾。不同的分支如果框架页不同，菜单图标的路径也不同)
			FrameMenu.initial("menu", menu, ctx + "/img/frame/menu-demo/");
			//设置系统时间(传参：时间控件ID)
			FrameTime.initial("datetime_");
			//初始化Tab(传参：mini-tab的ID)
			FrameTab.initial("main-tab");
			//加载首页。如果系统资源中配置了首页，则优先加载已配置的首页。否则，加载此处的首页！
			FrameTab.showHomePage(ctx + "/page/main.html");
		});

		function logout() {
			window.location.href = ctx + "/page/login.html";
		}

		var win = mini.get("detailWin");
		var form = new mini.Form("#detailForm");

		function changePassword() {
			win.setTitle("修改密码");
			win.showAtPos('center', 'middle');
		}

		function save() {
			var data = form.getData();
			if (!form.validate()) {
				return;
			}
			var loginPassword = data.loginPassword;
			var loginPassword2 = data.loginPassword2;
			if (loginPassword != loginPassword2) {
				miniui.showErrorMessageBox("二次输入的密码不一致！");
				return;
			}
			data.userID = userID;
			mini.mask({
				el: document.body,
				cls: 'mini-mask-loading',
				html: '数据保存中...'
			});
			http.post("/user/changePassword.do", data, function (page) {
				mini.unmask();
				win.hide();
				mini.alert("保存成功", "提示", null);
				datagrid.reload();
			});
		}

		function cancel() {
			win.hide();
		}
	</script>
</body>

</html>